module.exports = (app) => {
  const { Schema, model, getModelName } = app.jax.mongoose
  const modelName = getModelName(__filename)

  const RequestLogSchema = new Schema({
    url: String,
    method: String,
    body: Schema.Types.Mixed,
    query: Schema.Types.Mixed,
    // session: Schema.Types.Mixed,
    headers: Schema.Types.Mixed,
    responseTime: Number, // 响应时间
    status: Number, // 响应状态

    apiCode: Number, // API响应状态
    response: String, // 响应数据
    stack: String, // 内容
    exception: String, // 异常
    ip: String, // IP
  })

  return model('RequestLog', RequestLogSchema)
}
